import QtQuick
import QtQuick3D

//controller用于获取输入并输出操控指令

QtObject{
    id:root
    default property list<QtObject> children

    property Node controlledActor:null//被操控的对象

    Component.onCompleted: {
        if(controlledActor)
        {
            controlledActor.controller = root
        }
    }

    onControlledActorChanged: {
        if(oldControlledActor)
        {
            if(oldControlledActor.controller !== undefined)
            {
                oldControlledActor.controller = null
            }
        }

        if(controlledActor)
        {
            if(controlledActor.controller !== undefined)
            {
                controlledActor.controller = root
            }
        }

        oldControlledActor = controlledActor
    }

    property Node oldControlledActor:null

    //输入设备
    property Input inputDevice:null
}
